package com.aaa.entity;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class LayData {

    /**
     * code = 0 layui需要的数据 0 成功
     */
    private Integer code=0;
    private String msg="";
    private Long count;
    private Object data;


    public LayData(Object data) {
        this.code=0;
        this.msg="成功";

        // 是一个pageInfo
        if(data instanceof PageInfo){
            this.count= ((PageInfo) data).getTotal();
            this.data=((PageInfo<?>) data).getList();
        }else{
            this.data=data;
        }



    }
}
